﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GlacialComponents.Controls;

namespace TodesesserMapEditor
{
    public partial class MainWnd : Form
    {
        public static DrawingPanel tmpDrawPanel;
        public MainWnd()
        {
            InitializeComponent();
        }

        private void MainWnd_Load(object sender, EventArgs e)
        {
            tmpDrawPanel = new DrawingPanel();
            tmpDrawPanel.MdiParent = this;
            tmpDrawPanel.Show();
            tmpDrawPanel.WindowState = FormWindowState.Maximized;
            loopTimer.Enabled = true;
            loopTimer.Start();
            SetupObjectWallList();
        }

        void SetupObjectWallList()
        {
            //Setup Object and Wall into ListView

            //Clear current List
            objectWallList.Items.Clear();
            //Setup List
            string[] tempItemStr1 = { "basicWall", "Wall", "1" };
            objectWallList.Items.Add(new ListViewItem((tempItemStr1)));
            string[] tempItemStr2 = { "barrier", "Wall", "2" };
            objectWallList.Items.Add(new ListViewItem((tempItemStr2)));
            string[] tempItemStr3 = { "enemySpawner", "Object", "1" };
            objectWallList.Items.Add(new ListViewItem((tempItemStr3)));
            string[] tempItemStr4 = { "playerSpawnPoint", "Object", "2" };
            objectWallList.Items.Add(new ListViewItem((tempItemStr4)));
            
        }

        private void loopTimer_Tick(object sender, EventArgs e)
        {
            layers_view.Items.Clear();
            foreach (objectObject item in tmpDrawPanel.objectArray)
            {
                string[] stringArray = { tmpDrawPanel.objectArray.IndexOf(item).ToString(), "?", "Object", item.object_index.ToString() };
                layers_view.Items.Add(new ListViewItem(stringArray));
            }
            foreach (wallObject item in tmpDrawPanel.wallArray)
            {
                string[] stringArray = { tmpDrawPanel.wallArray.IndexOf(item).ToString(), "?", "Wall", item.wall_index.ToString() };
                layers_view.Items.Add(new ListViewItem(stringArray));
            }
        }
    }
}
